print("Welcome to SageMaker!")
Accessing and Running Labs in Amazon SageMaker
Module 1
The labs in this course use Amazon SageMaker to host Jupyter Lab environments. This section provides an overview of SageMaker and guides you through accessing and using the Jupyter Lab interface.
1.1. Logging into the AWS Console
Note
Your credentials are available in the student portal. If you don’t have access to the portal, ask the instructor for help.
Please log into AWS with your assigned credentials. AWS is a cloud technology and is frequently updated. As a result, you may have to improvise if there are changes in the interface. Please don’t hesitate to ask your instructor if there are any questions.
-
Open your preferred web browser and navigate to: https://console.aws.amazon.com
-
Select "IAM User"
-
Enter your account alias.
-
Press Next
-
Sign in with your AWS credentials
1.2. Navigating to Amazon Sagemaker AI
From the AWS Console, you will be able to access the AWS Sagemaker AI environment.
-
In the AWS Management Console search bar, type "SageMaker AI"
-
Open Sagemaker dashboard by clicking the result for "Amazon Sagemaker AI"
-
In the SageMaker dashboard, click on "Notebooks" in the left sidebar
-
Under the "Notebook Instances" header, you will see a list of existing Notebook instances.
Important
If you don’t see any existing notebooks, check these things:
-
Make sure you’re in the correct AWS region (typically
us-west-2). - Make sure to use the correct account if you have multiple AWS accounts.
Ask the instructor for help if you’re still unable to locate the SageMaker notebook.
-
Make sure you’re in the correct AWS region (typically
1.3. Managing Notebook Instances
Notebook instances are the primary lab environment for SageMaker. You can start, stop, and manage these instances from the SageMaker dashboard. The status for each notebook instance is displayed in the "Status" column.
The primary states are:
- InService: The notebook instance is running and ready to use
- Stopped: The notebook instance is stopped and not incurring compute charges
- Pending: The notebook instance is being provisioned
1.3.1. Starting a Notebook Instance
To start a new notebook instance click the "Start" button next to the notebook instance name.
1.3.2. Stopping a Notebook Instance
To stop a notebook instance:
-
Select the notebook instance by clicking the name
-
Click next to the notebook instance name.
1.4. Accessing Jupyter Lab
Once the notebook is "InService" you can access the Jupyter Lab environment by clicking the "Open JupyterLab" button next to the notebook instance name.
1.5. Working with JupyterLab
If you have not worked with Jupyter Lab before, it’s a powerful tool for data science and machine learning workflows. This section will guide you through creating your first notebook and writing some code. If you’re already familiar with Jupyter Lab, you can skip this section.
-
Click the "+" button in the top left corner of Jupyter Lab to open the Launcher
-
Under "Notebook" select
conda_python3instance-
This creates a Jupyter notebook kernel of type
conda_python3
-
This creates a Jupyter notebook kernel of type
-
Right-click the Notebook name on the left-side menu, and select Rename (default is “Untitled.ipynb”)
-
Enter the new name:
SageMaker_Introduction.ipynb -
In the first cell, enter the following code and execute it with Shift+Enter or by pressing "Play" button on the toolbar:
-
In the next cell, import common libraries and verify your SageMaker setup:
import numpy as np import pandas as pd import sagemaker from sagemaker import get_execution_role # Get the SageMaker execution role role = get_execution_role() print(f"SageMaker Role: {role}")
1.6. Essential Jupyter Lab Operations
Understanding keyboard shortcuts and cell operations will significantly improve the lab experience. Here are some essential shortcuts and operations to get you started.
1.6.1. Command Mode Shortcuts
To enter command mode, press Esc. Then use these shortcuts:
| Shortcut | Action |
|---|---|
A |
Insert cell above |
B |
Insert cell below |
DD |
Delete cell |
M |
Change to Markdown cell |
Y |
Change to code cell |
Shift+Enter |
Run cell and move to next |
1.6.2. Edit Mode Shortcuts
To enter edit mode, press Enter. Then use these shortcuts:
| Shortcut | Action |
|---|---|
Shift+Enter |
Run cell and move to next |
Ctrl+Enter |
Run cell and stay |
Alt+Enter |
Run cell and insert below |
-
Create a new cell (press B)
-
Enter this markdown text:
# My First SageMaker Notebook This notebook demonstrates basic SageMaker functionality. -
Convert to markdown (click outside shell, press M)
-
Execute the cell (press Shift+Enter)
1.6.3. Save Your Work
Proper saving ensures your work is preserved between sessions.
-
Save your notebook:
- Press Ctrl+S, or
- Click File → Save Notebook
-
Download a local backup:
-
Click File → Download
-
Select "Notebook (.ipynb)"
-
Creating a Simple Python Agent
Module 2
-
Open the Jupyter Notebook file
simple-python-agent/simple-python-agent.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Implementing Round Robin Communication with AutoGen
Module 3
-
Open the Jupyter Notebook file
round-robin-chat/round-robin-chat.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Implementing a Reactive Agent in AutoGen
Module 4
-
Open the Jupyter Notebook file
autogen-reactive-agent/autogen-reactive-agent.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Implementing a Deliberative Agent in LangGraph
Module 5
-
Open the Jupyter Notebook file
langgraph-deliberative-agent/langgraph-deliberative-agent.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Building an Agent with Long-Term Memory
Module 6
-
Open the Jupyter Notebook file
long-term-memory/long-term-memory.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Integrating an Observation Tool in an Agent
Module 7
-
Open the Jupyter Notebook file
using-observation-tools/using-observation-tools.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Integrating an Action Tool in an Agent
Module 8
-
Open the Jupyter Notebook file
using-action-tools/using-action-tools.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Implementing a Hierarchical Planning Strategy
Module 9
-
Open the Jupyter Notebook file
hierarchical-planning/hierarchical-planning.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Building an Agent with Rule-Based Reasoning
Module 10
-
Open the Jupyter Notebook file
rule-based-reasoning/rule-based-reasoning.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Evaluating the Robustness of an Agentic System
Module 11
-
Open the Jupyter Notebook file
evaluating-agentic-robustness/evaluating-agentic-robustness.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Building a Personal Assistant Agent
Module 12
-
Open the Jupyter Notebook file
building-personal-assistant/building-personal-assistant.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.
Implementing Error Recovery and Resilience
Module 13
-
Open the Jupyter Notebook file
implementing-error-recovery/implementing-error-recovery.ipynbin the Jupyter Lab environment. -
Follow the instructions in the notebook to complete the lab.